package com.sola.api2;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * 这个微服务不用OAuth2.0资源服务器保护，直接读取JWT，只在zuul进行鉴权
 * */
@RestController
@EnableEurekaClient
@SpringBootApplication
public class Api2Application {

    public static void main(String[] args) {
        SpringApplication.run(Api2Application.class, args);
    }

    @GetMapping("/app2")
    public String demo(HttpServletRequest request){
        String token = request.getHeader("Authorization").replace("bearer ", "");
        return token;
    }
}
